/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "require_item")
@NamedQueries({
    @NamedQuery(name = "RequireItem.findAll", query = "SELECT r FROM RequireItem r"),
    @NamedQuery(name = "RequireItem.findByRiId", query = "SELECT r FROM RequireItem r WHERE r.riId = :riId"),
    @NamedQuery(name = "RequireItem.findByRiDescription", query = "SELECT r FROM RequireItem r WHERE r.riDescription = :riDescription"),
    @NamedQuery(name = "RequireItem.findByRiName", query = "SELECT r FROM RequireItem r WHERE r.riName = :riName")})
public class RequireItem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ri_id")
    private Integer riId;
    @Column(name = "ri_description")
    private String riDescription;
    @Basic(optional = false)
    @Column(name = "ri_name")
    private String riName;
    @JoinColumn(name = "r_id", referencedColumnName = "r_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Require require;

    public RequireItem() {
    }

    public RequireItem(Integer riId) {
        this.riId = riId;
    }

    public RequireItem(Integer riId, String riName) {
        this.riId = riId;
        this.riName = riName;
    }

    public Integer getRiId() {
        return riId;
    }

    public void setRiId(Integer riId) {
        this.riId = riId;
    }

    public String getRiDescription() {
        return riDescription;
    }

    public void setRiDescription(String riDescription) {
        this.riDescription = riDescription;
    }

    public String getRiName() {
        return riName;
    }

    public void setRiName(String riName) {
        this.riName = riName;
    }

    public Require getRequire() {
        return require;
    }

    public void setRequire(Require require) {
        this.require = require;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (riId != null ? riId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RequireItem)) {
            return false;
        }
        RequireItem other = (RequireItem) object;
        if ((this.riId == null && other.riId != null) || (this.riId != null && !this.riId.equals(other.riId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.RequireItem[riId=" + riId + "]";
    }

}
